
using System;

namespace AdventureWorks.Client.Silverlight
{
    public partial class EmployeeSearch
    {
        partial void PostInitialize()
        {
            btnDetails.Click += delegate { OpenDetails(); };
            btnNew.Click += delegate { CreateNew(); };
        }

        private void OpenDetails()
        {
            if (gridResults.SelectedIndex >= 0)
            {
                //[TODO: navigate to the right details page]
                NavigationService.Source = new Uri("/Gen/_EmployeeObjectPage.xaml?EmployeeId="
                    + list[gridResults.SelectedIndex].EmployeeIdProperty.Value.Value, UriKind.Relative);
            }
        }

        private void CreateNew()
        {
            //[TODO: navigate to the right details page]
            NavigationService.Source = new Uri("/Gen/_EmployeeObjectPage.xaml", UriKind.Relative);
        }
    }
}
